<?php
/* ---SESSAO DA RESENHA--- */
@session_start();
unset($_SESSION["promocao"]);
/* --------------------- */

include "../../jerimum/classes/bd.php";
include "../../jerimum/classes/lances.php";
$_classLance	= new lances();

//busca dados do lance
$_classLance->id = htmlentities($_GET["idLance"]);
$dados	= $_classLance->pega();

//tenho que criar 
//$foto	= $_anu->pegaimagem($dados['id']);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>INSERIR LANCE �NICO >> <?php if($dados["descricao"] != null) echo htmlentities($dados["descricao"]);?> >> </title>
<link href="../../css/estrutura.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript">
                
                function BlockKeybord()
                {
                        if(window.event) // IE
                        {
                                if((event.keyCode < 48) || (event.keyCode > 57))
                                {
                                        event.returnValue = false;
                                }
                        }
                        else if(e.which) // Netscape/Firefox/Opera
                        {
                                if((event.which < 48) || (event.which > 57))
                                {
                                        event.returnValue = false;
                                }
                        }

                        
                }

                function troca(str,strsai,strentra)
                {
                        while(str.indexOf(strsai)>-1)
                        {
                                str = str.replace(strsai,strentra);
                        }
                        return str;
                }

                function FormataMoeda(campo,tammax,teclapres,caracter)
                {
                        if(teclapres == null || teclapres == "undefined")
                        {
                                var tecla = -1;
                        }
                        else
                        {
                                var tecla = teclapres.keyCode;
                        }

                        if(caracter == null || caracter == "undefined")
                        {
                                caracter = ".";
                        }

                        vr = campo.value;
                        if(caracter != "")
                        {
                                vr = troca(vr,caracter,"");
                        }
                        vr = troca(vr,"/","");
                        vr = troca(vr,",","");
                        vr = troca(vr,".","");

                        tam = vr.length;
                        if(tecla > 0)
                        {
                                if(tam < tammax && tecla != 8)
                                {
                                        tam = vr.length + 1;
                                }

                                if(tecla == 8)
                                {
                                        tam = tam - 1;
                                }
                        }
                        if(tecla == -1 || tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105)
                        {
                                if(tam <= 2)
                                {
                                        campo.value = vr;
                                }
                                if((tam > 2) && (tam <= 5))
                                {
                                        campo.value = vr.substr(0, tam - 2) + ',' + vr.substr(tam - 2, tam);
                                }
                                if((tam >= 6) && (tam <= 8))
                                {
                                        campo.value = vr.substr(0, tam - 5) + caracter + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
                                }
                                if((tam >= 9) && (tam <= 11))
                                {
                                        campo.value = vr.substr(0, tam - 8) + caracter + vr.substr(tam - 8, 3) + caracter + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
                                }
                                if((tam >= 12) && (tam <= 14))
                                {
                                        campo.value = vr.substr(0, tam - 11) + caracter + vr.substr(tam - 11, 3) + caracter + vr.substr(tam - 8, 3) + caracter + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
                                }
                                if((tam >= 15) && (tam <= 17))
                                {
                                        campo.value = vr.substr(0, tam - 14) + caracter + vr.substr(tam - 14, 3) + caracter + vr.substr(tam - 11, 3) + caracter + vr.substr(tam - 8, 3) + caracter + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
                                }
                        }
                }

                function maskKeyPress(objEvent)
                {
                        var iKeyCode;
                                                
                        if(window.event) // IE
                        {
                                iKeyCode = objEvent.keyCode;
                                if(iKeyCode>=48 && iKeyCode<=57) return true;
                                return false;
                        }
                        else if(e.which) // Netscape/Firefox/Opera
                        {
                                iKeyCode = objEvent.which;
                                if(iKeyCode>=48 && iKeyCode<=57) return true;
                                return false;
                        }
                        
                        
                }
        </script>


</head>

<body style="background-color:#FAFAFA">

<form action="index.php" method="post">
<input type="hidden" name="idlance" id="idlance" value="<?php if($dados["descricao"] != null) echo $dados['id']?>" />
<div style="width:525px; margin:0px auto; background:#FAFAFA; padding:5px">
<div id="boxheader">
  <h2>INSIRA AGORA O VALOR ÚNICO PARA SEU LANCE:<span style=" font-size:12px; font-weight:normal"><br />
     <strong>Você pode ser o sortudo ganhador deste prêmio!</strong></h2>
</div>
<div id="review_body">
  <p>
    <label for="fullname">Valor Único:</label><br />
    <input name="valor" id="valor" size="10" maxlength="10" onkeydown="FormataMoeda(this,10,event)" onkeypress="return maskKeyPress(event)"  />

  </div>


<input name="button" type="reset" class="gh-btn" id="button2" value="Limpar" style="background-color:#F00; color:#FFFFFF; cursor:pointer" />
<input name="button2" type="submit" class="gh-btn" id="button3" value="Confirmar" style="background-color:#0A0; color:#FFFFFF; cursor:pointer;" />
 &gt;&gt; pr&oacute;ximo passo</div>
</form>
</body>
</html>
